package richbar.com.richbar.activity.me;

import android.app.Activity;
import android.content.Intent;
import android.webkit.WebView;
import android.widget.TextView;

import com.common.base.BaseActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import richbar.com.richbar.R;
import richbar.com.richbar.help.TitleHelp;

/**
 * Created by Administrator on 2018/12/21.
 */

public class GoHtmlAc extends BaseActivity {
    @BindView(R.id.webView)
    WebView webView;

    @Override
    public int initLayout() {
        return R.layout.ac_html;
    }

    @Override
    public void initTitle() {
        new TitleHelp(this).setTitle(getitle());
    }

    @Override
    public void initView() {
        ButterKnife.bind(this);
    }

    @Override
    public void initData() {
        //设置WebView属性，能够执行Javascript脚本
        webView.getSettings().setJavaScriptEnabled(true);

        try {
            //设置打开的页面地址
            webView.loadUrl(getUrl());
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    public static void start(Activity activity, String url, String Title) {
        Intent intent = new Intent(activity, GoHtmlAc.class);
        intent.putExtra("url", url);
        intent.putExtra("Title", Title);
        activity.startActivity(intent);
    }

    /**
     * 标题
     *
     * @return
     */
    public String getitle() {
        return getIntent().getStringExtra("Title");
    }

    public String getUrl() {
        return getIntent().getStringExtra("url");
    }
}
